package com.cxz.study.ddd_project.application.controller;

import com.cxz.study.ddd_2081_project.api.v1.dto.base.WhSerialNoRecordDTO;
import com.cxz.study.ddd_2081_project.api.v1.param.base.WhSerialNoRecordParam;
import com.cxz.study.ddd_2081_project.api.v1.service.base.WhSerialNoRecordClientService;
import com.cxz.study.ddd_project.application.util.BeanConvert;
import com.cxz.study.ddd_project.domain.biz.model.base.WhSerialNoRecordBO;
import com.cxz.study.ddd_project.domain.biz.service.WhSerialNoRecordBizService;
import com.cxz.study.ddd_project_parent_api.common.ResponseData;
import com.cxz.study.ddd_project_parent_web.web.interceptor.AutoWarpReposeData;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @className: WhSerialNoRecordController
 * @author: ocxz1
 * @date: 2024/12/29 下午9:49
 * @Version: 1.0
 * @description: ddd_project1
 */
@RestController
@RequestMapping("base")
@AutoWarpReposeData
public class WhSerialNoRecordController implements WhSerialNoRecordClientService {

    @Resource
    private WhSerialNoRecordBizService whSerialNoRecordBizService;

    @RequestMapping("/findList")
    @Override
    public ResponseData<List<WhSerialNoRecordDTO>> findList(@RequestBody WhSerialNoRecordParam param) {

        WhSerialNoRecordBO bo = BeanConvert.convertToWhSerialNoRecordBO(param);
        List<WhSerialNoRecordBO> list = whSerialNoRecordBizService.findList(bo);

        return ResponseData.success(BeanConvert.convertToWhSerialNoRecordDTOList(list));
    }

    @RequestMapping("/findList3")
    public List<WhSerialNoRecordDTO> findList3(@RequestBody WhSerialNoRecordParam param) {

        WhSerialNoRecordBO bo = BeanConvert.convertToWhSerialNoRecordBO(param);
        List<WhSerialNoRecordBO> list = whSerialNoRecordBizService.findList(bo);

        return BeanConvert.convertToWhSerialNoRecordDTOList(list);
    }
}
